#include <iostream>

using std::cout;
using std::endl;

class B
{
public:
	B()
	{
        cout << "B()" << endl;
    }
    
    ~B()
    {
        cout << "~B()" << endl;
    }
    
    B(const B &rhs)
    {
        cout << "B(const B&)" << endl;
    }

    B &operator=(const B &rhs)
    {
        cout << "B &operator=(const B &s)" << endl;
        return  *this;
    }
};

B func(const B &rhs)
{
    cout << "B func(const B &)" << endl;
    return rhs;//拷贝构造函数
}

int main(int argc, char **argv)
{
	B b1,b2;//两次无参
    cout << "1111" << endl;
    b2 = func(b1);//10#  临时对象会给b2赋值 临时对象销毁析构函数
    cout << "2222" << endl;
    return 0;
 }
